# -*- coding: utf-8 -*-
# @Time    : 2024/9/6 下午4:53
# @Author  : liujun
# @Email   : 2592730854@qq.com
# @File    : release_diet_details_page.py
# @Software: PyCharm

from appium.webdriver.common.appiumby import AppiumBy as By

class ReleaseDietDetailsPage:
    """记录饮食详情页面"""

    #早餐
    breakfast_locator=(By.XPATH,'//android.view.View[@content-desc="早餐 257 千卡"]')
    #午餐
    lunch_locator=(By.XPATH,'//android.view.View[@content-desc="午餐"]')
    #晚餐
    dinner_locator=(By.XPATH,'//android.view.View[@content-desc="晚餐"]')
    #加餐
    snack_locator=(By.XPATH,'//android.view.View[@content-desc="加餐"]')
    #添加后的框
    add_frame_locator=(By.XPATH,'//android.view.View[@content-desc="鸡蛋(煮) 1 个 86 千卡"]')



    def __init__(self, driver):
        self.driver = driver

    def click_breakfast(self):  #点击早餐
        self.driver.find_element(*self.breakfast_locator).click()

    def click_lunch(self):  #点击午餐
        self.driver.find_element(*self.lunch_locator).click()

    def click_dinner(self):  #点击晚餐
        self.driver.find_element(*self.dinner_locator).click()

    def click_snack(self):  #点击加餐
        self.driver.find_element(*self.snack_locator).click()

    def add_frame_txt(self): #添加早餐后的文本
        return self.driver.find_element(*self.add_frame_locator).text.strip()


